////////////////////////////////////////////////////////////////////////////////
//                                                                            //
// This file is a part of PMCG project. PMCG is the acronym of Physical       //
// Methods in Computer Graphics.                                              //
//                                                                            //
// Classical algorithms in computer graphics use discrete objects in 3D space //
// like vectors, matrices, triangles, planes. Physical way use an  analytical //
// objects like function, scalar and vector fields. Physical way gives new    //
// look to classical algorithms and allows to overcome some difficulties of   //
// pure geometric methods.                                                    //
//                                                                            //
// Project site:                                                              //
//     http://code.google.com/p/pmcg/                                         //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////

#ifndef VECTOR3D_H
#define VECTOR3D_H

//! Vector in 3D Euclidian space
class Vector3D
{
// methods
public:
    Vector3D();
    Vector3D(double x, double y, double z);
    ~Vector3D();

    void Normalize();

    //! Sum of the two vectors.
    friend const Vector3D operator+ (const Vector3D & a, const Vector3D & b);
    //! Difference between two vectors.
    friend const Vector3D operator- (const Vector3D & a, const Vector3D & b);
    //! Dot product.
    friend double operator* (const Vector3D & a, const Vector3D & b);
    //! Cross product
    friend const Vector3D operator^ (const Vector3D & a, const Vector3D & b);
    //! Divide vector on constant
    friend const Vector3D operator/ (const Vector3D & a, double alpha);

// members
public:
    double m_x;
    double m_y;
    double m_z;
};

#endif // VECTOR3D_H
